package com.moorror.cola.strategy.plugin.bean;

import com.alibaba.cola.extension.ExtensionPointI;
import com.intellij.psi.PsiClass;
import org.apache.commons.compress.utils.Lists;

import java.util.List;

/**
 * @Author jiyanghuang
 * @Date 2023/7/15 17:37
 */
public class ExtensionPointIWrap implements ExtensionPointI {

    private PsiClass psiClass;

    private String desc;

    public static ExtensionPointIWrap of(PsiClass psiClass, String desc){
        ExtensionPointIWrap extensionPointIWrap = new ExtensionPointIWrap();
        extensionPointIWrap.setPsiClass(psiClass);
        extensionPointIWrap.setDesc(desc);
        return extensionPointIWrap;
    }


    public PsiClass getPsiClass() {
        return psiClass;
    }

    public void setPsiClass(PsiClass psiClass) {
        this.psiClass = psiClass;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static List<PsiElementWrapper> convert(ExtensionPointIWrap extensionPointIWrap){
        List<PsiElementWrapper> psiElementWrappers = Lists.newArrayList();
        PsiElementWrapper psiElementWrapper = new PsiElementWrapper(extensionPointIWrap.getPsiClass());
        psiElementWrapper.setFaceClassName(extensionPointIWrap.getPsiClass().getQualifiedName());
        psiElementWrapper.setDesc(extensionPointIWrap.getDesc());
        psiElementWrappers.add(psiElementWrapper);
        return psiElementWrappers;
    }
}
